home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / www / library / implemen / htrules.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  4.1 KB  |  164 lines

  1. /*                                                           Configuration Manager for libwww
  2.                                   CONFIGURATION MANAGER
  3.                                              
  4.    Author Tim Berners-Lee/CERN. Public domain. Please mail changes to timbl@info.cern.ch.
  5.    
  6.    The configuration information loaded includes tables (file suffixes, presentation
  7.    methods) in other modules.  The most likely routines needed by developers will be:
  8.    
  9.   HTSetConfiguration      to load configuration information.
  10.                          
  11.   HTLoadRules             to load a whole file of configuration information
  12.                          
  13.   HTTranslate             to translate a URL using the rule table.
  14.                          
  15.  */
  16. #ifndef HTRULE_H
  17. #define HTRULE_H
  18.  
  19. #include "HTUtils.h"
  20.  
  21. typedef enum _HTRuleOp {
  22.         HT_Invalid,
  23.         HT_Map,
  24.         HT_Pass,
  25.         HT_Fail,
  26.         HT_DefProt,
  27.         HT_Protect
  28. } HTRuleOp;
  29.  
  30. #ifdef SHORT_NAMES
  31. #define HTSearSc HTSearchScript
  32. #endif /*SHORT_NAMES*/
  33.  
  34. /*
  35.  
  36. Server Side Script Execution
  37.  
  38.    If a URL starts with /htbin/ it is understood to mean a script execution request on
  39.    server. This feature needs to be turned on by setting HTBinDir by the htbin rule.
  40.    Index searching is enabled by setting HTSearchScript into the name of script in BinDir
  41.    doing the actual search by search rule (BinDir must also be set in this case, of
  42.    course).
  43.    
  44.  */
  45.  
  46. extern char * HTBinDir;         /* Physical /htbin location */
  47. extern char * HTSearchScript;   /* Search script name */
  48.  
  49. /*
  50.  
  51. HTAddRule:  Add rule to the list
  52.  
  53.   ON ENTRY,
  54.   
  55.   pattern                points to 0-terminated string containing a single "*"
  56.                          
  57.   equiv                  points to the equivalent string with * for the place where the
  58.                          text matched by * goes.
  59.                          
  60.   ON EXIT,
  61.   
  62.   returns                0 if success, -1 if error.
  63.                          
  64.    Note that if BYTE_ADDRESSING is set, the three blocks required are allocated and
  65.    deallocated as one. This will save time and storage, when malloc's allocation units are
  66.    large.
  67.    
  68.  */
  69. extern int HTAddRule PARAMS((HTRuleOp op, const char * pattern, const char * equiv));
  70.  
  71.  
  72. /*
  73.  
  74. HTClearRules: Clear all rules
  75.  
  76.   ON EXIT,
  77.   
  78.   Rule file               There are no rules
  79.                          
  80.   returns
  81.                           0 if success, -1 if error.
  82.                          
  83.  */
  84.  
  85. #ifdef __STDC__
  86. extern int HTClearRules(void);
  87. #else
  88. extern int HTClearRules();
  89. #endif
  90.  
  91.  
  92. /*
  93.  
  94. HTTranslate: Translate by rules
  95.  
  96.  */
  97.         
  98. /*
  99.  
  100.   ON ENTRY,
  101.   
  102.   required                points to a string whose equivalent value is neeed
  103.                          
  104.   ON EXIT,
  105.   
  106.   returns                 the address of the equivalent string allocated from the heap
  107.                          which the CALLER MUST FREE. If no translation occured, then it is
  108.                          a copy of the original.
  109.                          
  110.  */
  111. #ifdef __STDC__
  112. extern char * HTTranslate(const char * required);
  113. #else
  114. extern char * HTTranslate();
  115. #endif
  116.  
  117.  
  118. /*
  119.  
  120. HTSetConfiguration:  Load one line of configuration information
  121.  
  122.   ON ENTRY,
  123.   
  124.   config                  is a string in the syntax of a rule file line.
  125.                          
  126.    This routine may be used for loading configuration information from sources other than
  127.    the  rule file, for example INI files for X resources.
  128.    
  129.  */
  130. extern int HTSetConfiguration PARAMS((CONST char * config));
  131.  
  132.  
  133. /*
  134.  
  135. HtLoadRules:  Load the rules from a file
  136.  
  137.   ON ENTRY,
  138.   
  139.   Rule table              Rules can be in any state
  140.                          
  141.   ON EXIT,
  142.   
  143.   Rule table              Any existing rules will have been kept. Any new rules will have
  144.                          been loaded on top, so as to be tried first.
  145.                          
  146.   Returns                 0 if no error.
  147.                          
  148.  */
  149.  
  150. #ifdef __STDC__
  151. extern int HTLoadRules(const char * filename);
  152. #else
  153. extern int HTLoadRules();
  154. #endif
  155. /*
  156.  
  157.  */
  158.  
  159.  
  160. #endif /* HTUtils.h */
  161. /*
  162.  
  163.    end */
  164.